package com.xzy.sms.web.domain.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.xzyframework.persistence.BaseEntity;

/**
 * @desc 用户实体
 * @author wjw
 * @time 2017年11月16日下午3:32:13
 */
@Entity
@Table(name = "pub_user")
public class User extends BaseEntity {
    
    /** 序列化 */
    private static final long serialVersionUID = -936203994181527906L;
    
    /** 主键id */
    @Id
    @GeneratedValue(generator = "UIDGenerator")
    @GenericGenerator(name = "UIDGenerator", strategy = "com.xzyframework.persistence.UIDGenerator")
    @Column(length = 40)
    private String userId;
    
    /** 用户姓名 */
    @NotNull(message = "用户姓名不能为空")
    @NotBlank(message = "用户姓名不能为空")
    @Column(length = 40)
    private String name;
    
    /** 账号 */
    @NotNull(message = "账号不能为空")
    @NotBlank(message = "账号不能为空")
    @Column(length = 50, updatable = false)
    private String account;
    
    /** 邮箱 */
    @Column(length = 50)
    private String email;
    
    /** 电话 */
    @Column(length = 15)
    private String phone;
    
    /** 最后登陆日期 */
    @JsonIgnore
    private Date lastLoginDate;
    
    /**
     * 密码 ,密码已经设置为不能update，因为到数据的时候可能会被覆盖，要修改密码可以使用其他脚本方法。
     */
    @Column(length = 80, updatable = false, nullable = true)
    @JsonIgnore
    private String password;
    
    /** 昵称 */
    @Column(length = 30)
    private String nick;
    
    /** 头像id 同步的时候不能修改 */
    @Column(length = 40, updatable = false)
    private String avatarId;
    
    /**
     * 构造函数
     */
    public User() {
    }
    
    /**
     * 构造函数
     */
    public User(String userId) {
        this.userId = userId;
    }
    
    /**
     * @return name
     */
    public String getName() {
        return name;
    }
    
    /**
     * @param name 要设置的 name
     */
    public void setName(String name) {
        this.name = name;
    }
    
    /**
     * @return account
     */
    public String getAccount() {
        return account;
    }
    
    /**
     * @param account 要设置的 account
     */
    public void setAccount(String account) {
        this.account = account;
    }
    
    /**
     * @return email
     */
    public String getEmail() {
        return email;
    }
    
    /**
     * @param email 要设置的 email
     */
    public void setEmail(String email) {
        this.email = email;
    }
    
    /**
     * @return phone
     */
    public String getPhone() {
        return phone;
    }
    
    /**
     * @param phone 要设置的 phone
     */
    public void setPhone(String phone) {
        this.phone = phone;
    }
    
    /**
     * @return lastLoginDate
     */
    public Date getLastLoginDate() {
        return lastLoginDate;
    }
    
    /**
     * @param lastLoginDate 要设置的 lastLoginDate
     */
    public void setLastLoginDate(Date lastLoginDate) {
        this.lastLoginDate = lastLoginDate;
    }
    
    /**
     * @return the password
     */
    public String getPassword() {
        return password;
    }
    
    /**
     * @param password the password to set
     */
    public void setPassword(String password) {
        this.password = password;
    }
    
    /**
     * @return nick
     */
    public String getNick() {
        return nick;
    }
    
    /**
     * @param nick 要设置的 nick
     */
    public void setNick(String nick) {
        this.nick = nick;
    }
    
    /**
     * @return avatarId
     */
    public String getAvatarId() {
        return avatarId;
    }
    
    /**
     * @param avatarId 要设置的 avatarId
     */
    public void setAvatarId(String avatarId) {
        this.avatarId = avatarId;
    }
    
    /**
     * @return the userId
     */
    public String getUserId() {
        return userId;
    }
    
    /**
     * @param userId the userId to set
     */
    public void setUserId(String userId) {
        this.userId = userId;
    }
    
}
